package com.guavamail.smtp;

import java.util.Properties;

import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class STMPClientTest {

	public static final int PORT = 25;

	public static void main(String[] args) {
		Properties props = new Properties();
		props.setProperty("mail.smtp.host", "localhost");
		props.setProperty("mail.smtp.port", Integer.toString(PORT));

		Session session = Session.getInstance(props);

		try {
			MimeMessage message = new MimeMessage(session);
			message.addRecipient(Message.RecipientType.TO, new InternetAddress("anyone@anywhere.com"));
			message.addRecipient(Message.RecipientType.TO, new InternetAddress("anyone2@anywhere.com"));
			message.setFrom(new InternetAddress("someone@somewhereelse.com"));
			message.setSubject("barf");
			message.setText("bodyalksdjflkasldfkasjldfkjalskdfjlaskjdflaksdjflkjasdlfkjl");

			Transport.send(message);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
